const Mock = require('mockjs')

const data = Mock.mock({
    'items|100': [{
        'companyID': '@increment(1)',
        companyCity: '@cword(2,3)',
        companyLocation: '@cword(2,3) 区',
        'companyInstCode|9': '@integer(0,9)',
        companyChineseName: '@cword(14)',
        'companyEnglishName|9': '@character',
        companyNature: '@cword(2,6)',
        companyIndustry: '@cword(2,6)',
        companyBusiness: '@cword(2,6)',
        companyContacts: '@cname',
        companyAddress: '@cword(20)',
        'companyPostcode|6': '@integer(0,9)',
        'companyPhone|11': '@integer(0,9)',
        'companyFax|11': '@integer(0,9)',
        companyEmail: '@email',
        companyRecordStatus: '@integer(0,4)',
        companySubmitTime: '@datetime'
    }],
    hasAdded: false
})

module.exports = [
    {
        url: '/province/reportExamine/getAllRecords',
        type: 'get',
        response: config => {
            if (!data.hasAdded) {
                for (let index = 0; index < data.items.length; index++) {
                    data.items[index].companyLocation = data.items[index].companyCity + " 市 " + data.items[index].companyLocation
                }
                data.hasAdded = true
            }
            
            const items = data.items
            return {
                code: 200,
                data: {
                    items: items
                }
            }
        }
    }
]
